package designpatterns.iterator;

import java.util.ArrayList;
import java.util.List;

// 具体聚合
public class Aggregate1 implements Aggregate {
    private List<Object> list = new ArrayList<>();

    @Override
    public void add(Object o) {
        list.add(o);
    }

    @Override
    public void remove(Object o) {
        list.remove(o);
    }

    @Override
    public Iterator iterator() {
        return new Iterator1(list);
    }
}
